package tests;


import java.util.HashSet;
import java.util.Set;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import business.Curso;
import business.Perfil;
import business.Professor;

public class CursoTest {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}
	
	@Test
	public void ConstructValid(){
		Set<Professor> profs = new HashSet<Professor>();
		Professor p = new Professor();
		p.setNome("prof");
		Curso a = new Curso("LEI", 137, p, p, profs);
	}
	
	@Test (expected=AssertionError.class)
	public void ConstructInvalidName(){
		Set<Professor> profs = new HashSet<Professor>();
		Professor p = new Professor();
		p.setNome("prof");
		Curso a = new Curso(null, 137, p, p, profs);
	}
	
	@Test (expected=AssertionError.class)
	public void ConstructInvalidNC(){
		Set<Professor> profs = new HashSet<Professor>();
		Professor p = new Professor();
		p.setNome("prof");
		Curso a = new Curso("LEI", -1, p, p, profs);
	}
	
	@Test (expected=AssertionError.class)
	public void ConstructInvalidProf1(){
		Set<Professor> profs = new HashSet<Professor>();
		Professor p = new Professor();
		p.setNome("prof");
		Curso a = new Curso("LEI", 137, null, p, profs);
	}
	
	@Test (expected=AssertionError.class)
	public void ConstructInvalidProf2(){
		Set<Professor> profs = new HashSet<Professor>();
		Professor p = new Professor();
		p.setNome("prof");
		Curso a = new Curso("LEI", 137, p, null, profs);
	}
	
	@Test (expected=AssertionError.class)
	public void ConstrucInvalidComission(){
		Set<Professor> profs = new HashSet<Professor>();
		Professor p = new Professor();
		p.setNome("prof");
		Curso a = new Curso("LEI", 137, p, p, null);
	}
	
	@Test
	public void SetValidName(){
		Curso a = new Curso();
		a.setNome("LEI");
	}

	@Test (expected=AssertionError.class)
	public void SetInvalidName(){
		Curso a = new Curso();
		a.setNome(null);
	}
	
	@Test
	public void SetValidNC(){
		Curso a = new Curso();
		a.setNumerusClausus(55);
	}

	@Test (expected=AssertionError.class)
	public void SetInvalidNC(){
		Curso a = new Curso();
		a.setNumerusClausus(-1);
	}
	
	@Test
	public void SetValidCoord(){
		Curso a = new Curso();
		Professor p = new Professor();
		p.setNome("prof");
		a.setCoordenador(p);
	}

	@Test (expected=AssertionError.class)
	public void SetInvalidCoord(){
		Curso a = new Curso();
		a.setCoordenador(null);
	}
	
	@Test
	public void SetValidCoordE(){
		Curso a = new Curso();
		Professor p = new Professor();
		p.setNome("prof");
		a.setCoordenadorErasmus(p);
	}

	@Test (expected=AssertionError.class)
	public void SetInvalidCoordE(){
		Curso a = new Curso();
		a.setCoordenadorErasmus(null);
	}

	@Test (expected=AssertionError.class)
	public void AddInvalidToComission(){
		Curso a = new Curso();
		a.addComissaoCientifica(null);
	}
	
	@Test
	public void objectosTester(){
		Curso.objectos();
	}
	
	@Test
	public void resetTester(){
		Curso.reset();
	}
	
	@Test
	public void perfisTester(){
		Curso c = new Curso();
		Perfil p = new Perfil();
		p.setCurso(c);
		c.perfis();
	}
	
	@Test
	public void getterTester(){
		Curso c = new Curso();
		c.getClass();
		c.getComissaoCientifica();
		c.getCoordenador();
		c.getCoordenadorErasmus();
		c.getNome();
		c.getNumerusClausus();
	}
	
	@Test
	public void toStringTester(){
		
		Curso c = new Curso();
		c.toString();
		
	}
	
	@Test
	public void addComissaoCientifica(){
		Curso c = new Curso();
		c.addComissaoCientifica(new Professor());
	}
}
